package com.yokit.c2c.controller;

import com.yokit.c2c.pojo.Category;
import com.yokit.c2c.response.ResponseObject;
import com.yokit.c2c.service.CategoryService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author fengzeng
 * @create 2021/6/17 17:30
 */
@RestController
public class CategoryController {

  @Resource
  private CategoryService categoryService;

  /**
   * 商品分类
   * @return
   */
  @RequestMapping(value = "/cat", method = RequestMethod.GET)
  public ResponseObject getCatTreeList() {
    List<Category> categories = categoryService.selectAll();
    return new ResponseObject(200, "获取菜单成功", categories);
  }
}
